Skip to content

fix(news): custom RSS feed save fails with validation error when no logo#329

Merged
ChuckBuilds merged 1 commit into
mainfrom
fix/news-custom-rss-feed-validation
May 13, 2026
Merged

fix(news): custom RSS feed save fails with validation error when no logo#329
ChuckBuilds merged 1 commit into
mainfrom
fix/news-custom-rss-feed-validation

Conversation

@ChuckBuilds

@ChuckBuilds ChuckBuilds commented May 13, 2026

Copy link
Copy Markdown
Owner

Root Cause

_set_missing_booleans_to_false was unconditionally creating an empty dict for every nested-object sub-property when processing array items. For the news plugin's custom_feeds, this produced logo: {} on every feed item where no logo was uploaded.

jsonschema then validated that empty object against the logo schema's required: ["id", "path"] constraint and rejected it — even though logo itself is optional on the item.

Execution order that exposed the bug:

  1. fix_array_structures — converts {"0": {...}}[{...}]
  2. _set_missing_booleans_to_falseinjected logo: {} on items with no logo
  3. _filter_config_by_schema — passed arrays through unchanged (didn't strip the empty object)
  4. validate_config_against_schemafailed on logo: {} missing id and path

Changes

_set_missing_booleans_to_false (api_v3.py ~line 4279): Skip recursion into a nested object sub-property when it isn't already present in the array item. The function's purpose is to set unchecked boolean checkboxes to False — there's no reason to create an optional object like logo just to search for booleans inside it.

_filter_config_by_schema (api_v3.py ~line 4426): Extended to recurse into array items when the items schema has properties. Previously arrays passed through unchanged, so any extra field on a feed item (legacy data, migration artifacts) would survive to validation where additionalProperties: false would reject it. This is a defensive improvement that catches any future similar case.

Test Plan

  • Add a custom RSS feed with name + URL but no logo → save → should succeed (was failing)
  • Add a custom RSS feed with a logo uploaded → save → should still succeed
  • Edit an existing feed with a logo → save without changing the logo → should still succeed
  • Confirm config/config.json has no spurious logo: {} entries on feeds without logos

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved form validation for configurations with nested objects and arrays to ensure stricter adherence to defined schemas, preventing invalid data submission.
    • Fixed handling of boolean checkbox values in nested forms during partial submissions to avoid creating unintended empty objects.
    • Enhanced schema-based configuration filtering to consistently remove extra fields that would fail validation against defined constraints.

Review Change Stack

_set_missing_booleans_to_false was unconditionally creating an empty
dict for every nested-object sub-property when processing array items.
For the news plugin's custom_feeds, this produced logo:{} on every feed
item that had no logo uploaded. jsonschema then validated that empty
object against logo's required:["id","path"] constraint and failed.

Fix: skip recursion into a sub-object when it isn't already present in
the array item. There's no reason to create an optional object like
logo just to look for boolean fields inside it.

Also extend _filter_config_by_schema to recurse into array items when
the items schema has properties. Previously arrays were passed through
unchanged, so any stray field on a feed item (legacy data, migration
artifacts) would survive to validation where additionalProperties:false
would reject it.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented May 13, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0ed89cff-0ba2-47fe-9df3-439395259833

📥 Commits

Reviewing files that changed from the base of the PR and between 3b45a75 and fddd316.

📒 Files selected for processing (1)
  • web_interface/blueprints/api_v3.py

📝 Walkthrough

Walkthrough

This PR refines two internal configuration helpers in api_v3.py. Boolean backfilling now conservatively checks existence before recursing into nested objects, preventing spurious empty object creation during partial form submissions. Schema-based filtering was expanded to recursively process arrays of objects, ensuring extra fields are consistently stripped regardless of nesting depth.

Changes

Configuration Form and Schema Handling

Layer / File(s) Summary
Boolean field backfilling for nested objects
web_interface/blueprints/api_v3.py
_set_missing_booleans_to_false now checks that sub-object keys exist and are dicts before descending into them, avoiding creation of new optional sub-objects during boolean backfilling for partial checkbox submissions within array items.
Schema-based filtering for nested arrays and objects
web_interface/blueprints/api_v3.py
_filter_config_by_schema now recursively filters array properties containing objects with properties; each array element is filtered using schema matching with correct prefix handling to strip extra fields consistently.

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The pull request title refers to fixing RSS feed validation, but the changeset modifies internal helper functions in api_v3.py for form processing and schema filtering, which is not specifically about RSS feeds. Update the title to reflect the actual changes, such as: 'fix(api): prevent creation of empty objects in nested form properties during array processing' or similar, or if the RSS context is important, ensure changes align with that scope.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/news-custom-rss-feed-validation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@ChuckBuilds ChuckBuilds merged commit 452afac into main May 13, 2026
2 checks passed
@ChuckBuilds ChuckBuilds deleted the fix/news-custom-rss-feed-validation branch May 13, 2026 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant